define(["app"], function(app) {
	var deps = ["$http", "BaseService"];
	
	function resource($http, BaseService) {
		return initLineResource($http,BaseService.restfulUrl + "invoice/", BaseService.formHeader);
	}
	var postHeader = {
			"Content-Type" : "application/x-www-form-urlencoded;charset=utf-8"
	};
	function initLineResource($http,lineUrl, headers){
		return {
			getParma : function(invoiceNum){	
				return $http.get(lineUrl+'queryInvoiceParam',{
					params: {
						invoiceCode: invoiceNum,
						requestType:1
                    }
				});
			},
			
			getConfig: function(corpid,agentid,url){	
				return $http.get(lineUrl+'getConfig',{
					params: {
						requestType:1,
						corpid:corpid,
						agentid:agentid,
						type:new Date(),
						url:url
                    }
				});
			},
			//$scope.codeImg="restful/invoice/showYzm?requestType=1&invoiceCode="+$scope.invoiceNum+"&invoiceTypeId="+$scope.invoiceType+"&cityId="+$scope.cityid+"&type="+new Date();

			getYzm : function(requestType,invoiceCode,invoiceTypeId,cityId){	
				return $http.get(lineUrl+'queryVerificationCode',{
					params: {
						invoiceCode: invoiceCode,
						invoiceTypeId:invoiceTypeId,
						cityId:cityId,
						requestType:1,
						type:new Date()
                    }
				});
			},
			getInvoiceDetail:function(parmaList,invoiceCode,invoiceTypeId,cityId,sessionId){
				return $http.get(lineUrl+'queryInvoiceDetail',{
					params: {
						parmaList: parmaList,
						invoiceCode: invoiceCode,
						invoiceTypeId: invoiceTypeId,
						cityId: cityId,
						session:sessionId,
						requestType:1,
						type:new Date()
                    }
				});
			}
		
		/*,
			saveLine:function(line){
				return $http.post(lineUrl + "saveLine", angular.toJson(line));
			},
			updateLine:function(line){
				return $http.post(lineUrl + "updateLine", angular.toJson(line));
			},
			getLineById:function(lineId){
                return $http.get(lineUrl+"getLineById",{
                    params:{
                        lineId:lineId
                    }
                });
            }*/
		};
	}
	resource.$inject = deps;
	app.lazy.factory("InvoiceResources", resource);
});
